-
Notifications
You must be signed in to change notification settings - Fork 9
PM-1551 - integrate the AI workflow events #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PM-1551 - integrate the AI workflow events #116
Conversation
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
src/shared/modules/global/submission-scan-complete.orchestrator.ts
Outdated
Show resolved
Hide resolved
); | ||
return; | ||
} | ||
if (!process.env.PGBOSS_DATABASE_URL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable name has been changed from PG_BOSS_DB_URL
to PGBOSS_DATABASE_URL
. Ensure that this change is reflected in all relevant documentation and deployment configurations to avoid runtime errors.
); | ||
} | ||
this.logger.log('QueueSchedulerService initialized'); | ||
this.boss = new PgBoss(process.env.PGBOSS_DATABASE_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor for PgBoss
now uses process.env.PGBOSS_DATABASE_URL
instead of process.env.PG_BOSS_DB_URL
. Verify that this change is consistent across the codebase and that the new environment variable is correctly set in all environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Merging for testing.
https://topcoder.atlassian.net/browse/PM-1551 - Integrate webhook event processing with tc workflow
-> event from kafka received for scan complete
-> SubmissionScanCompleteOrchestrator catches it and calls the workflowQueueHandler to queue all the necessary ai workflows
-> WorkflowQueueHandler starts a Prisma TX and creates the DB workflowRun entries with a "INIT" status
-> WorkflowQueueHandler calls QueueSchedulerService.queueJob for each workflowRun (DISPATCH_AI_REVIEW_WORKFLOWS and PG_BOSS_DB_URL env vars need to be set for this to happen)
-> QueueSchedulerService registers the queued jobs
-> WorkflowQueueHandler marks the workflowRuns as "QUEUED"
-> QueueSchedulerService starts processing the jobs queue (via pgboss) and takes each job in each queue (each git workflow has it's own queue created based on the aiWorkflow.gitWorkflowId)
-> WorkflowQueueHandler takes care of processing the queue job, and with the help of giteaService it dispatches a git workflow run
-> Webhook service catches the git events and for "workflow_job" it will call WorkflowQueueHandler.handleWorkflowRunEvents.
-> WorkflowQueueHandler handles the webook events, and depending on the event received it will:
And that's pretty much it.